<template>
	<view class="header">
		<image src="@/static/images/top2.png" class="topImg"></image>
		<view class="title">			
			<uni-icons v-if="back" class='backBtn' @tap="backBtn" type="back" size="22" color="#fff"></uni-icons>
			<uni-icons v-if="index" class='backBtn' @tap="indexBtn" type="back" size="22" color="#fff"></uni-icons>
			{{title}}
		</view>
	</view>
</template>

<script>
	export default {
		name:"header",
		props: [ 'title', 'back', 'index' ],
		data() {
			return {
				
			}
		},
		methods: {
			backBtn() {
				uni.navigateBack()
			},
			indexBtn() {
				uni.switchTab({
					url: '/pages/index/index'
				});
			},
		}
	}
</script>

<style>
	.header {
		width: 100%;
		z-index: 10;
		position: fixed;
		top: 0;
	}
	.topImg {
		width: 100%;
		height: 50px;
		z-index: 1;
		position: absolute;
	}
	.title {
		line-height: 50px;
		text-align: center;
		z-index: 2; 
		position: relative;
		font-weight: bold;
		color: #fff;
	}
	.backBtn {
		position: absolute;
		left: 10px;
	}
</style>